<template>
  <div>
    <Header1 :activeIndex=5></Header1>
    <div class="newsCenterPanel">
      <div class="title">
        <span href="#" target="_self">{{news.newsTitle}}</span>
      </div>
      <div style="float: right;margin-right: 250px;font-size: 13px;" >
        <span >浏览：{{news.lookNum}}次</span>
        <span style="margin-left: 20px">发布时间：{{makeDate(news.createTime)}}</span>

      </div>


      <div class="content">
        <div  v-html='news.newsContent' >
        </div>
        <br>
        <span style="float: right;margin-right: 50px;font-size: 13px;">发布人：{{news.createPerson}}</span>
      </div>

    </div>
  </div>


</template>

<script>
  import Header1 from "../header/Header"
  import {makeDate, makeSimpleDate} from "../../common/js/dateformat"

  export default {
    name: "user-news-detail",
    components:{
      Header1,
    },
    data(){
      return {
        loading:false,
        news:{},
        newsId:'',
      }
    },
    created(){

      this.newsId= this.$route.query.newsId;
      this.getNewsById();
    },
    methods:{
      getNewsById(){
        this.loading=true;
        this.$ajax.post(this.$config.url + `news/selNewsById`,{
          "newsId":this.newsId,
            }
        ).then(res => {
          if(res.data.message=="succ"){
            this.news = res.data.object;
            this.loading = false;
          }else{
            this.$message.error("出错了，未找到该新闻信息")
          }

        }).finally(() => {
        })
      },
      makeSimpleDate(date) {
        return makeSimpleDate(date);
      },
      makeDate(date) {
        return makeDate(date)
      },
    }
  }
</script>

<style scoped>
  .newsCenterPanel .title{position: relative; width: 100%; height: 85px; line-height: 85px; margin: 1px auto 10px auto; font-size: 25px; font-weight: normal; padding-top: 30px}
  .newsCenterPanel .title span{display: block; width: 100%; color: #2e2e30; text-align: center;}
  .content{
    width: 800px;
    margin:50px  auto 0 auto;
  }
</style>